<?php
class CountModel extends Model {
	public function mfile($p,$limit){
		$files=M("mongo");
		
		import('@.ORG.Page');
		$count = $files->where(array("status"=>1))->count();
		
		$Page = new Page($count,$limit);
		
		$list = $files->where(array("status"=>1))->limit($p.','.$limit)->order('id desc')->select();
		$show  = $Page->show();
		
		$liste=$list;
		foreach($list as $k=>$vo){
			$liste[$k]['user_id']=$this->guser($vo['user_id']);
		}
//		dump($p);
		return array("page"=>$show,"list"=>$liste);
	}
	
	public function upmogo($wid){
		$data["status"]='0';
		M("mongo")->where(array("wid"=>$wid))->save($data);
	}
	
	function guser($uid){
		$user=M("user");
		$find=$user->where(array("user_id"=>$uid))->find();
		return $find['nickname'];
	}
}
?>